package com.tuling.bio;

import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;

@SuppressWarnings("all")
public class Client {
    public static void main(String[] args) {

        Socket socket = null;
        OutputStream outputStream = null;
        try {
            socket = new Socket("127.0.0.1", 9999);
            outputStream = socket.getOutputStream();

            //jvm中申请这个大小的内存，拷贝到内核态中
            byte[] bytes = "hello,socketServer".getBytes();

            outputStream.write(bytes);
            System.out.println("发送完成");
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                socket.close();
                outputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
